<%@page import="java.sql.*"%> 
<%@page import="java.util.*"%> 
<%@page contentType="text/html" pageEncoding="UTF-8" session="false"  %>

<%
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
%>

<%
    Class.forName("com.mysql.jdbc.Driver");
    String url = "jdbc:mysql://"
            + System.getenv("MOPAAS_MYSQL25292_HOSTNAME") + ":"
            + System.getenv("MOPAAS_MYSQL25292_PORT") + "/"
            + System.getenv("MOPAAS_MYSQL25292_NAME") + "?user="
            + System.getenv("MOPAAS_MYSQL25292_USER") + "&password="
            + System.getenv("MOPAAS_MYSQL25292_PASSWORD")
            + "&characterEncoding=utf-8";
    out.println( this.getServletContext().getRealPath("/WEB-INF") );
 if ( url != null ){return;}
    Connection conn = DriverManager.getConnection(url);
    try {
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("select 1");
        while (rs.next()) {
            out.print("OO:" + rs.getInt(1));
        }
    } finally {
        conn.close();
    }
%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1> 
        <h2> <%= new java.util.Date()%></h2>
    </body>
</html>
<%
    TreeSet<String> set = new TreeSet<String>();
    for (Map.Entry<String, String> envvar : System.getenv().entrySet()) {
        set.add(envvar.getKey() + ": " + envvar.getValue() + "<br>");

    }
    for (Object o : set) {
        out.println(o);
    }
%>